/**
 * 
 */
package com.jm.utils.rule;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import com.jm.utils.StringBuilderEx;

/**
 * @author yanjie
 * Nov 1, 2011 10:47:47 AM
 */
public class ACHelper {
	public static String getYearCodeList(int up, int down){
		return getYearCodeList(up,down,true);
	}
	/**
	 * @param up 上年份
	 * @param down 下年份
	 * @return
	 */
	public static String getYearCodeList(int up, int down,boolean bAsc){
		int nowyear = Integer.parseInt(new SimpleDateFormat("yyyy").format(new Date()));
		StringBuilderEx yr = new StringBuilderEx();
		
		if(bAsc){
			for(int i = 0;i<up;i++){
				yr.Append(String.valueOf(nowyear - up + i));
				yr.Append(";");
			}
		}else{
			for(int i = down-1;i>=0;i--){
				yr.Append(String.valueOf(nowyear + i + 1));
				yr.Append(";");
			}
		}
		
		yr.Append(String.valueOf(nowyear));
		yr.Append(";");
		
		if(bAsc){
			for(int i = 0;i<down;i++){
				yr.Append(String.valueOf(nowyear + i + 1));
				yr.Append(";");
			}
		}else{
			for(int i=up-1;i>=0;i--){
				yr.Append(String.valueOf(nowyear - up + i));
				yr.Append(";");
			}
		}
		return yr.toString();
	}
	
	public final static String MonthsOfYear = "1;2;3;4;5;6;7;8;9;10;11;12";
	
}
